#{extends 'main.html' /}
#{set title:'Attendance' /}

<script type="text/javascript" src="@{'/public/javascripts/anytime.js'}" ></script>
<link type="text/css" rel="stylesheet" href="@{'/public/stylesheets/anytime.css'}" />

<h2>Attendance of ${date}</h2>

<form action="@{Attendance.viewClasses()}">

Date <input type="text" id="date" name="date" value="${date}"> &nbsp;&nbsp;
<input type="submit" value="GO">

</form>

<script type="text/javascript">

var rangeDemoFormat = "%d/%m/%Y";
var e = new Date();
var l = new Date();

e.setYear(2010);
l.setYear(2100);

AnyTime.picker("date",
        { earliest: e,
          format: rangeDemoFormat,
          latest: l
        } );
        
$("#date").val('${date}');
</script>

<br>

#{list items:classes, as:'cs'}
<h2>${cs.get(0).registration.course.activity.name}</h2>
<table border="1">
<tr>
<th>ID</th>
<th>Student</th>
<th>Teacher</th>
<th>Course</th>
<th>DateTime</th>
<th>Student Attendance</th>
<th>Teacher Attendance</th>
<th>Payment</th>

</tr>

#{list items:cs, as:'c'}
<tr>
<td>${c.id}</td>
<td style="width: 10em;">${c.registration.student.getName()}</td>
<td style="width: 5em;">${c.registration.teacher.name}</td>
<td style="width: 5em;">${c.registration.course.name}</td>
<td>${c.datetime}</td>


<td>
	<form action="@{Attendance.takeAttendanceS()}">
	<input type="hidden" value="${date}" name = "date">
	<input type="hidden" value="${c.id}" name = "class_id">
	
            	#{if c.student_attendance == 1}
                <input type="radio" name="a" VALUE="1" checked="checked">Not Entered
                #{/if}
                #{else}
                <input type="radio" name="a" VALUE="1" onclick="this.form.submit()">Not Entered
                
                #{/else}
                #{if c.student_attendance == 2}
                <input type="radio" name="a" VALUE="2" checked="checked">Att
                #{/if}
                #{else}
                <input type="radio" name="a" VALUE="2" onclick="this.form.submit()">Att
                #{/else}
                #{if c.student_attendance == 3}
                <input type="radio" name="a" VALUE="3" checked="checked">Ab
                #{/if}
                #{else}
                <input type="radio" name="a" VALUE="3" onclick="this.form.submit()">Ab
                #{/else}
                #{if c.student_attendance == 4}
                <input type="radio" name="a" VALUE="4" checked="checked">Ex
                #{/if}
                #{else}
                <input type="radio" name="a" VALUE="4" onclick="this.form.submit()">Ex
                #{/else}
                &nbsp;
    
    </form>        
</td>
<td>
<form action="@{Attendance.takeAttendanceT()}">
	<input type="hidden" value="${c.id}" name = "class_id">
	<input type="hidden" value="${date}" name = "date">			
				#{if c.teacher_attendance == 1}
                <input type="radio" name="a" VALUE="1" checked="checked">Not Entered
                #{/if}
                #{else}
                <input type="radio" name="a" VALUE="1" onclick="this.form.submit()">Not Entered
                
                #{/else}
                #{if c.teacher_attendance == 2}
                <input type="radio" name="a" VALUE="2" checked="checked">Att
                #{/if}
                #{else}
                <input type="radio" name="a" VALUE="2" onclick="this.form.submit()">Att
                #{/else}
                #{if c.teacher_attendance == 3}
                <input type="radio" name="a" VALUE="3" checked="checked">Ab
                #{/if}
                #{else}
                <input type="radio" name="a" VALUE="3" onclick="this.form.submit()">Ab
                #{/else}
                #{if c.teacher_attendance == 4}
                <input type="radio" name="a" VALUE="4" checked="checked">Ex
                #{/if}
                #{else}
                <input type="radio" name="a" VALUE="4" onclick="this.form.submit()">Ex
                #{/else}
                &nbsp;
    </form>        
</td>

<td><form action="@{Application.view_registration()}" method="POST">
 		<input type="hidden" name="registration_id" value="${c.registration.id}">
 		<input type="submit" value="Access">
 	</form>	
</td>
</tr>
#{/list}
</table>
<br>
#{/list}


